package com.fs.global.config;

import com.fs.service.WxPayService;
import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;

/**
 * @author : ppx
 * @date : 14:58 2021/3/11
 */
@ConfigurationProperties(prefix = "custom.wechat",ignoreUnknownFields = false)
public class WxPayConfig {

    private String mchId;

    private String appId;

    private String appSecret;

    private String mchSerialNo;

    private String v3Key;

    private String notifyUrl;

    private String mchKeyPath;

    private PrivateKey privateKey;

    private AutoUpdateCertificatesVerifier verifier;


    public AutoUpdateCertificatesVerifier getVerifier() {
        return verifier;
    }

    public void setVerifier(AutoUpdateCertificatesVerifier verifier) {
        this.verifier = verifier;
    }

    public PrivateKey getPrivateKey() {
        return privateKey;
    }


    public void setPrivateKey(PrivateKey privateKey) {
        this.privateKey = privateKey;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public void setMchSerialNo(String mchSerialNo) {
        this.mchSerialNo = mchSerialNo;
    }

    public void setV3Key(String v3Key) {
        this.v3Key = v3Key;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public void setMchKeyPath(String mchKeyPath) {
        this.mchKeyPath = mchKeyPath;
    }

    public String getMchId() {
        return mchId;
    }

    public String getAppId() {
        return appId;
    }

    public String getAppSecret() {
        return appSecret;
    }

    public String getMchSerialNo() {
        return mchSerialNo;
    }

    public String getV3Key() {
        return v3Key;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public String getMchKeyPath() {
        return mchKeyPath;
    }
}
